#pragma once
#include "..\activewnd\ActiveWnd.h"
#include "clientlib.h"

using namespace ACTIVECTRL;

class CGameMainWnd
    : public IGameRender,
    public IPlayerIOEvent
{
public:
    DWORD   m_dwRef;
    STDMETHOD_(HRESULT, QueryInterface)(REFIID riid, void** ppvObject);
    STDMETHOD_(ULONG, AddRef)();
    STDMETHOD_(ULONG, Release)();

    //////////////////////////////////////////////////////////////////////////
    // IGameConst
    STDMETHOD(GetEstimateTime)(DWORD* pMillisecond);
    STDMETHOD(GetPlayerNum)(IGameConst::PLAYERNUMBER* pNumber);
    STDMETHOD(GetGameIdentifier)(char* pIdentifier);
    STDMETHOD(GetVersion)(VERSION_STRUCT* pVersionStruct);

    //////////////////////////////////////////////////////////////////////////
    // IGameConst
    IClientSite*    m_pSite;
    IGamePlayer*    m_pMyself;
    CSafeLink*      m_pLink;
    STDMETHOD(SetClientSite)(IClientSite* pSite);
    STDMETHOD(OnInitialize)();
    STDMETHOD(OnWaitingStart)();
    STDMETHOD(OnGameStart)();
    STDMETHOD(OnGameEnd)(void* lpScoreBuf);
    STDMETHOD(OnSceneChanged)(SCENE* pScene);
    STDMETHOD(Stop)(char* pReason);
    STDMETHOD(OnPlayerStateChanged)(int nIdx, int nState, IGamePlayer* pPlayer);
    STDMETHOD(OnGameOperation)(int opID, LPOPDATA oData, int nSize);
    STDMETHOD(RequestConfirmQuit)();
    STDMETHOD(Clear)();
    STDMETHOD(__NoopFunc1)() { return S_OK;}
    virtual void __NoopFunc2() {}

    //////////////////////////////////////////////////////////////////////////
    // IPlayerIOEvent
    STDMETHOD(OnUserEnter)(int nIdx, IGamePlayer* pPlayer);
    STDMETHOD(OnUserExit)(int nIdx, IGamePlayer* pPlayer);
    STDMETHOD(OnUserOffline)(int nIdx, IGamePlayer* pPlayer);
    STDMETHOD(OnUserReplay)(int nIdx, IGamePlayer* pPlayer);

    //////////////////////////////////////////////////////////////////////////
    // IGameCreator
    STDMETHOD(OnFrameConnected)(IClientFrame* pFrame);
    STDMETHOD(QueryRender)(IGameRender** ppRender);
    STDMETHOD(GetGameDescription)(char* pName, char* pDesc);
};